/*
 * @Author: szx
 * @Date: 2021-10-25 11:36:57
 * @LastEditTime: 2021-10-25 11:46:58
 * @Description:
 * @FilePath: \leetcode\26\26.go
 */
package main

func removeDuplicates(nums []int) int {
	if len(nums) == 0 {
		return 0
	}
	res := 0
	for i := 1; i < len(nums); i++ {
		if nums[i] != nums[res] {
			res++
			nums[res] = nums[i]
		}
	}
	return res + 1
}
func main() {

}
